package foo.bar.wiki.web.extension;

import foo.bar.wiki.domain.Comment;
import foo.bar.wiki.services.WikiService;
import net.sourceforge.stripes.validation.ValidationError;
import net.sourceforge.stripes.integration.spring.SpringBean;

import java.util.Collection;

/**
 * @author tmjee
 * @version $Date$ $Id$
 */
public class CommentTypeConverter extends AbstractIdentifiableTypeConverter<Comment> {

    private WikiService wikiService;


    protected Comment _convert(String id, Class<? extends Comment> targetType, Collection<ValidationError> errors) {
        return wikiService.getCommentById(id);
    }


    @SpringBean("wikiService")
    public void setWikiService(WikiService wikiService) {
        this.wikiService = wikiService;    
    }
}
